home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / esc.arc / ESC.DOC < prev    next >
Text File  |  1986-08-27  |  21KB  |  498 lines

  1.  
  2. _______ PROGRAM:  ESC.COM _______________________________________________
  3.  
  4.  
  5.         PURPOSE:  utility to configure DOS ANSI console.
  6.  
  7.           USAGE:  ESC xxxxxx
  8.  
  9.           WHERE:  xxxxxx is an ANSI escape sequence.
  10.  
  11.  
  12.   Escape sequences are control codes that change cursor, screen, keyboard,
  13.   or speaker attributes.  Control codes are useful for customizing your PC
  14.   without having to deal directly with console hardware.
  15.  
  16.   ANSI consoles are devices that respond to "ANSI X3.64" escape sequences.
  17.   American Standard terminals are ANSI console devices.  The IBM PC is not
  18.   an ANSI device and does not respond to escape codes until you install an
  19.   ANSI "console device driver."
  20.  
  21.   DOS provides a driver called "ANSI.SYS" that responds to a subset of the
  22.   ANSI X3.64 control codes - enough to configure your display and keyboard.
  23.  
  24.  
  25.     Install the DOS console driver by adding the statement:
  26.  
  27.                        device = ANSI.SYS
  28.  
  29.     to your "CONFIG.SYS" file.  Make sure DOS can find the file ANSI.SYS
  30.     by copying it from the DOS system disk to your "working" system disk.
  31.     If you have a fixed disk, copy ANSI.SYS to the root directory of C:\.
  32.  
  33.  
  34.     If you have no CONFIG.SYS file, you can create one by typing...
  35.  
  36.   ...at the DOS prompt> copy con config.sys <cr>
  37.                        device  = ANSI.SYS <cr>
  38.                        buffers = 24 <cr>
  39.                        <ctrl-Z><cr>
  40.  
  41.     This file tells DOS to use the ANSI console driver - and tells DOS to
  42.     use 12Kb of RAM to buffer disk data.  Change the number of BUFFERS to
  43.     fine tune disk I/O.  The default disk buffer is about 2Kb.
  44.  
  45.     DOS reads CONFIG.SYS when you fire up your PC or reboot: CTRL-ALT-DEL.
  46.  
  47.  
  48.  
  49.  
  50. ______ ESCAPE SEQUENCES ________________driver: DOS ANSI.SYS_____________
  51.  
  52.                                         source: DOS Technical Reference
  53.  
  54.  
  55.           ESC [#A          cursor up # lines
  56.                            where # = number of lines to move
  57.                            default # = 1
  58.                            ignored at top of screen
  59.  
  60.           ESC [#B          cursor down # lines
  61.                            where # = number of lines to move
  62.                            default # = 1
  63.                            ignored at bottom of screen
  64.  
  65.           ESC [#C          cursor right # columns
  66.                            where # = number of columns to move
  67.                            default # = 1
  68.                            ignored at end of screen
  69.  
  70.           ESC [#D          cursor left # columns
  71.                            where # = number of cols to move
  72.                            default # = 1
  73.                            ignored at beginning of screen
  74.  
  75.           ESC [r;cH        position cursor at row r column c
  76.                            where r = 1 to 24 and c = 1 to 80
  77.                            default r = 1       default c = 1
  78.  
  79.           ESC [r;cf        position cursor at row r column c
  80.                            where r = 1 to 24 and c = 1 to 80
  81.                            default r = 1       default c = 1
  82.  
  83.           ESC [6n          cursor position request - console
  84.                            sends back cursor position report:
  85.  
  86.                ESC [r;cR      cursor position report...
  87.                               where r = row and c = col
  88.                            ...in response to ESC [6n request.
  89.  
  90.           ESC [s           save current cursor position.
  91.                            the cursor is not moved, but its
  92.                            position is saved by DOS
  93.  
  94.           ESC [u           restore current cursor position.
  95.                            the cursor is moved to the saved
  96.                            row and column
  97.  
  98. __________________________________________________________________________
  99.  
  100.  
  101.           ESC [2J          clear screen - sends cursor home.
  102.  
  103.           ESC [K           erase from cursor to end of line.
  104.  
  105.  
  106. __________________________________________________________________________
  107.  
  108.  
  109.           ESC [#;...;#m    set graphics rendition to #
  110.                            where # include the following:
  111.  
  112.                                 00  =  all attributes OFF
  113.                                 01  =  bold ON
  114.                                 04  =  underscore (mono only)
  115.                                 05  =  blink ON
  116.                                 07  =  reverse ON
  117.                                 08  =  concealed ON
  118.  
  119.                                 30  =  black   foreground
  120.                                 31  =  red     foreground
  121.                                 32  =  green   foreground
  122.                                 33  =  yellow  foreground
  123.                                 34  =  blue    foreground
  124.                                 35  =  magenta foreground
  125.                                 36  =  cyan    foreground
  126.                                 37  =  white   foreground
  127.  
  128.                                 40  =  black   background
  129.                                 41  =  red     background
  130.                                 42  =  green   background
  131.                                 43  =  yellow  background
  132.                                 44  =  blue    background
  133.                                 45  =  magenta background
  134.                                 46  =  cyan    background
  135.                                 47  =  white   background
  136.  
  137.  
  138.           EXAMPLE:    ESC [01m               ...sets BOLD ON
  139.  
  140.           EXAMPLE:    ESC [00;37;44m         ...sets WHITE on BLUE
  141.  
  142.  
  143. __________________________________________________________________________
  144.  
  145.  
  146.           ESC [=#h         set screen mode to # where # =
  147.       or  ESC [=h
  148.       or  ESC [=0h               0  =  40x25 BLK & WHT
  149.       or  ESC [?7h               1  =  40x25 COLOR
  150.                                  2  =  80x25 BLK & WHT
  151.                                  3  =  80x25 COLOR
  152.                                  4  =  320x200 COLOR
  153.                                  5  =  320x200 BLK & WHT
  154.                                  6  =  640x200 BLK & WHT
  155.                                  7  =  wrap at end of line
  156.  
  157.           ESC [=#l         reset screen mode to # where # =
  158.       or  ESC [=l
  159.       or  ESC [=0l               0  =  40x25 BLK & WHT
  160.       or  ESC [?7l               1  =  40x25 COLOR
  161.                                  2  =  80x25 BLK & WHT
  162.                                  3  =  80x25 COLOR
  163.                                  4  =  320x200 COLOR
  164.                                  5  =  320x200 BLK & WHT
  165.                                  6  =  640x200 BLK & WHT
  166.                                  7  =  truncate at end of line
  167.  
  168. __________________________________________________________________________
  169.  
  170.  
  171.           ESC [#;#p                          redefine keyboard:
  172.       or  ESC [#;"string"p
  173.       or  ESC [#;"string";#;"string";#p      The first  #  ASCII code
  174.                                              specifies which key is to
  175.       or  any other combination of           be redefined.  Following
  176.           strings and decimal numbers         #  numbers or "strings"
  177.                                              redefine the key to ASCII
  178.                                              codes and/or strings.
  179.  
  180.  
  181.  
  182.   where  #  is the decimal number of an ASCII character:
  183.  
  184.  
  185.     dec   character      dec    key      dec    key      dec    key
  186.      0    ^@    NUL       32  <space>     64     @        96     `
  187.      1    ^A    SOH       33     !        65     A        97     a
  188.      2    ^B    STX       34     "        66     B        98     b
  189.      3    ^C    ETX       35     #        67     C        99     c
  190.      4    ^D    EOT       36     $        68     D       100     d
  191.      5    ^E    ENQ       37     %        69     E       101     e
  192.      6    ^F    ACK       38     &        70     F       102     f
  193.      7    ^G    BEL       39     '        71     G       103     g
  194.      8    ^H    BS        40     (        72     H       104     h
  195.      9    ^I    HT        41     )        73     I       105     i
  196.     10    ^J    LF        42     *        74     J       106     j
  197.     11    ^K    VT        43     +        75     K       107     k
  198.     12    ^L    FF        44     ,        76     L       108     l
  199.     13    ^M    CR        45     -        77     M       109     m
  200.     14    ^N    SO        46     .        78     N       110     n
  201.     15    ^O    SI        47     /        79     O       111     o
  202.     16    ^P    DLE       48     0        80     P       112     p
  203.     17    ^Q  DC1-XON     49     1        81     Q       113     q
  204.     18    ^R    DC2       50     2        82     R       114     r
  205.     19    ^S  DC3-XOFF    51     3        83     S       115     s
  206.     20    ^T    DC4       52     4        84     T       116     t
  207.     21    ^U    NAK       53     5        85     U       117     u
  208.     22    ^V    SYN       54     6        86     V       118     v
  209.     23    ^W    ETB       55     7        87     W       119     w
  210.     24    ^X    CAN       56     8        88     X       120     x
  211.     25    ^Y    EM        57     9        89     Y       121     y
  212.     26    ^Z    SUB       58     :        90     Z       122     z
  213.     27    ^[    ESC       59     ;        91     [       123     {
  214.     28    ^\    FS        60     <        92     \       124     |
  215.     29    ^]    GS        61     =        93     ]       125     }
  216.     30    ^^    RS        62     >        94     ^       126     ~
  217.     31    ^_    US        63     ?        95     _       127    DEL
  218.  
  219.  
  220.  
  221.   where  #  is the decimal number of a "special" character:
  222.  
  223.  
  224.      dec    char      dec    char      dec    char      dec    char
  225.      128     Ç        160     á        192     └        224     α
  226.      129     ü        161     í        193     ┴        225     ß
  227.      130     é        162     ó        194     ┬        226     Γ
  228.      131     â        163     ú        195     ├        227     π
  229.      132     ä        164     ñ        196     ─        228     Σ
  230.      133     à        165     Ñ        197     ┼        229     σ
  231.      134     å        166     ª        198     ╞        230     µ
  232.      135     ç        167     º        199     ╟        231     τ
  233.      136     ê        168     ¿        200     ╚        232     Φ
  234.      137     ë        169     ⌐        201     ╔        233     Θ
  235.      138     è        170     ¬        202     ╩        234     Ω
  236.      139     ï        171     ½        203     ╦        235     δ
  237.      140     î        172     ¼        204     ╠        236     ∞
  238.      141     ì        173     ¡        205     ═        237     φ
  239.      142     Ä        174     «        206     ╬        238     ε
  240.      143     Å        175     »        207     ╧        239     ∩
  241.      144     É        176     ░        208     ╨        240     ≡
  242.      145     æ        177     ▒        209     ╤        241     ±
  243.      146     Æ        178     ▓        210     ╥        242     ≥
  244.      147     ô        179     │        211     ╙        243     ≤
  245.      148     ö        180     ┤        212     ╘        244     ⌠
  246.      149     ò        181     ╡        213     ╒        245     ⌡
  247.      150     û        182     ╢        214     ╓        246     ÷
  248.      151     ù        183     ╖        215     ╫        247     ≈
  249.      152     ÿ        184     ╕        216     ╪        248     °
  250.      153     Ö        185     ╣        217     ┘        249     ∙
  251.      154     Ü        186     ║        218     ┌        250     ·
  252.      155     ¢        187     ╗        219     █        251     √
  253.      156     £        188     ╝        220     ▄        252     ⁿ
  254.      157     ¥        189     ╜        221     ▌        253     ²
  255.      158     ₧        190     ╛        222     ▐        254     ■
  256.      159     ƒ        191     ┐        223     ▀        255    0FFhex
  257.  
  258.  
  259.  
  260.   IBM PC console keys are specified by an "extended ASCII" code:
  261.  
  262.  
  263.                 for:     ESC [#;#;...p
  264.  
  265.          if first '#' =  0 <NUL>;
  266.       then second '#' =  the extended ASCII coded key:
  267.  
  268.             59 to 68  =  Function Keys  F1 to F10
  269.            94 to 103  =     CTRL-       F1 to F10
  270.             84 to 93  =    SHIFT-       F1 to F10
  271.           104 to 113  =      ALT-       F1 to F10
  272.                   15  =  SHIFT-Tab
  273.           120 to 131  =  ALT-  1  2  3  4  5  6  7  8  9  0  -  =
  274.             16 to 25  =  ALT-   Q  W  E  R  T  Y  U  I  O  P
  275.             30 to 38  =  ALT-    A  S  D  F  G  H  J  K  L
  276.             43 to 50  =  ALT-  \  Z  X  C  V  B  N  M
  277.                   82  =  Insert
  278.                   83  =  Delete
  279.                   71  =  Home
  280.                   79  =  End
  281.                   75  =  Cursor Left
  282.                   77  =  Cursor Right
  283.                   72  =  Cursor Up
  284.                   80  =  Cursor Down
  285.                   73  =  Page Up
  286.                   81  =  Page Down
  287.                    3  =  NUL ( since 0 is index to this table )
  288.  
  289.  
  290.  
  291.  
  292.           EXAMPLE:    ESC [36;156p          ...changes $ to £ character
  293.           EXAMPLE:    ESC [36;36p                 ...and then back to $
  294.  
  295.           EXAMPLE:    ESC [0;59;"DIR";13p         ...sets F1 to DIR<cr>
  296.           EXAMPLE:    ESC [0;59;0;59p            ...and then back to F1
  297.  
  298.  
  299.  
  300.  
  301. __________________________________________________________________________
  302.  
  303.  
  304.   You create console utilities by putting ESC commands in batch files.
  305.   This example modifies display attributes whenever you enter BLUE...
  306.  
  307.   ...at the DOS prompt> copy con blue.bat <cr>
  308.                        esc [00;34;40m <cr>
  309.                        <ctrl-Z><cr>
  310.  
  311.  
  312.   Use ESC commands to enhance existing batch files.  This D.BAT displays
  313.   a direcory listing using BLUE.BAT:
  314.                                                 ___________________
  315.                        echo off
  316.                        blue                     ...run BLUE.BAT
  317.                        esc [2J                  ...clear screen
  318.                        dir                      ...display files
  319.                        esc [00;32;40m           ...make prompt GRN
  320.  
  321.  
  322.  
  323. __________________________________________________________________________
  324.  
  325.  
  326.   The DOS PROMPT command can send ANSI escape sequences to your console.
  327.   Try the following PROMPT:
  328.  
  329.  
  330.     ( mono  )     A> PROMPT $e[01m$p$g $e[00m$e[K
  331.  
  332.  
  333.     ( color )     A> PROMPT $e[01;36;40m$p$g $e[00;32m$e[K
  334.  
  335.  
  336.   This sequence upgrades your 'A>' DOS prompt to a bold cyan that shows
  337.   the current directory; sets screen attributes to GRN on BLK; clearing
  338.   the prompt line for your command.  Changes remain in effect until you
  339.   issue another PROMPT command.  DOS PROMPT syntax includes:
  340.  
  341.                        $e   =  escape character
  342.                        $n   =  current drive
  343.                        $g   =  the > character
  344.                        $p   =  current directory
  345.                        $d   =  current date
  346.                        $t   =  current time
  347.                        $v   =  DOS version
  348.                        $l   =  the < character
  349.                        $q   =  the = character
  350.                        $b   =  the | character
  351.                        $$   =  the $ character
  352.                        $h   =  backspace
  353.                        $_   =  <cr><lf>
  354.                        $.   =  NUL character
  355.  
  356.                      $n$g   =  default PROMPT
  357.  
  358.  
  359.  
  360. __________________________________________________________________________
  361.  
  362.  
  363.   Put the console configuration that suits you into the file EXEC.BAT.
  364.   This example defines a key to run EXEC on your command:
  365.  
  366.                                                   ____________________
  367.        echo off
  368.        esc [=3h                                   ...80x25 color mode
  369.        esc [=7h                                   ...autowrap ON
  370.        esc [00;32;40m                             ...green on black
  371.        esc [2J                                    ...clear screen
  372.        esc [0;59;"CLS";13;"DIR";13p               F1  =  display files
  373.        esc [0;60;"CHKDSK";13p                     F2  =  status report
  374.        esc [0;61;"A:";13p                         F3  =  select A:
  375.        esc [0;62;"EDIT";13p                       F4  =  run EDIT.BAT
  376.        esc [0;63;"B:";13p                         F5  =  select B:
  377.        esc [0;64;"CALC";13p                       F6  =  run CALC.BAT
  378.        esc [0;65;"C:";13p                         F7  =  select C:
  379.        esc [0;66;"COMM";13p                       F8  =  run COMM.BAT
  380.        esc [0;67;"D:";13p                         F9  =  select D:
  381.        esc [0;68;"EXEC";13p                       F10 =  run EXEC.BAT
  382.        prompt $e[01;36;40m$p$g $e[00;32m$e[K      ...custom prompt
  383.  
  384.  
  385.   Edit EXEC.BAT to fine tune your custom console.  Make EXEC the default
  386.   console configuration by running it from AUTOEXEC.BAT.
  387.  
  388.  
  389.   EXEC should provide a  friendly  environment for you to issue commands
  390.   to the DOS prompt.  Application  programs  present  different  prompts
  391.   to the console operator.
  392.  
  393.   Copy EXEC to create new batch files such as EDIT, CALC, and COMM.BAT.
  394.   These files should:  configure the console for a specific application;
  395.   run the program;  and end with EXEC to reconfigure the console before
  396.   returning to DOS.
  397.  
  398.  
  399.  
  400.  
  401.  
  402. __Technical Notes_________________________________________________________
  403.  
  404.  
  405.   Because ESC.COM sends escape sequences to the "standard output" device,
  406.   you can redirect control codes to other DOS devices, such as a printer.
  407.   Use DOS "console redirection" to send an escape sequence to LPT1:
  408.  
  409.                        ESC xxxxxx >LPT1:
  410.  
  411.   This is useful for selecting print modes from your console; configuring
  412.   your printer on power up; and custom printing of text files.  Codes are
  413.   documented in your printer manual.
  414.  
  415.  
  416.  
  417.   You can redirect escape codes to a file.  Creative users will find...
  418.  
  419.                        ESC xxxxxx >config.con
  420.  
  421.   ...makes a file named CONFIG.CON containing an ANSI control code. Edit
  422.   this file to change the escape sequence.  Send CONFIG.CON to CON:
  423.  
  424.                        TYPE config.con
  425.  
  426.                   or   COPY config.con CON:
  427.  
  428.   ...and your ANSI console will respond to the control code in the file.
  429.   Copy CONFIG.CON to CONFIG.PRN and edit this file.  Send CONFIG.PRN to
  430.   your printer with:
  431.  
  432.                        COPY config.prn LPT1:
  433.  
  434.  
  435.     You could create a library of escape sequences, each a single file.
  436.     Use your editor to insert control codes from the library into text.
  437.     Such files display text in color at any location on the screen, or
  438.     print text in different styles on dot-matrix printers.
  439.  
  440.   To append additional escape sequences to an existing file, use:
  441.  
  442.                        ESC xxxxxx >>config.con
  443.  
  444.  
  445.  
  446.     It is more efficient to copy an ANSI configuration file containing
  447.     a string of escape sequences directly to CON: -- than it is to run
  448.     ESC.COM many times from a batch file.
  449.  
  450.     Redirect configuration batch files to "compile" them into simpler
  451.     files containing control code strings.  For example...
  452.  
  453.                        EXEC >exec.con
  454.  
  455.     ....redirects everything EXEC.BAT displays > to the file EXEC.CON.
  456.     Edit this file to delete characters that are not escape sequences.
  457.     What EXEC.BAT used to do is now accomplished simply:
  458.  
  459.                        TYPE exec.con
  460.  
  461.  
  462.  
  463.  
  464. __________________________________________________________________________
  465.  
  466.  
  467.   ANSI.SYS is a subset of the full ANSI X3.64 standard - some console
  468.   drivers have more features.  The most elegant ANSI is called FANSI.
  469.   FANSI provides back-scrolling and a type-ahead buffer, and features
  470.   high speed screen and keyboard drivers.
  471.  
  472.                        Hersey Micro Consulting, Inc.
  473.                        P.O. Box 8276
  474.                        Ann Arbor, MI 48107
  475.  
  476.               voice:  (313) 994-3259   0900 to 1700 EST
  477.               modem:  (313) 994-3946   2300 to 0800 EST
  478.  
  479.  
  480. __________________________________________________________________________
  481.  
  482.  
  483.  
  484.                    This disk copy provided as a service of
  485.  
  486.                         The Public (Software) Library
  487.  
  488.          For a copy of the latest monthly software library newsletter
  489.           and a list of the 600+ disks in the library, call or write
  490.  
  491.                         The Public (Software) Library
  492.                                 P.O.Box 35705
  493.                            Houston, TX 77235-5705
  494.                                (713) 721-6104
  495.  
  496.             Newsletter subscriptions are available for $12 a year.
  497.  
  498.